Preheat oven to 425 degrees F.Advertisement
Place red and green chiles in a single layer on a large rimmed baking sheet. Roast until softened and black in places, 10 to 20 minutes. When cool enough to handle, remove stems and seeds.
Place the chiles in a food processor. Add garlic, shallots, vinegar, molasses and salt; process until pureed, stopping to scrape down sides as needed. Transfer to a medium saucepan and bring to a boil. Reduce heat to maintain a simmer and cook, stirring often, for 15 minutes. Strain through a fine-mesh sieve, pressing on the solids to extract as much liquid as possible.
To make ahead: Refrigerate in a covered container for up to 1 week.