Place chilies and tomatoes in a 10- by 15-inch pan. Broil about 4 inches from heat, turning as needed, until vegetables are charred on all sides, about 5 minutes. Cool. Peel and stem chilies; for less heat, discard seeds. Peel tomatoes, cut in half crosswise, and squeeze out and discard seeds. Finely chop tomatoes and chilies and place in a bowl.
Add onions, garlic, cilantro, and salt and pepper to taste. If thicker than desired, add a little water to thin.