In a spice grinder, grind the allspice, black pepper, cloves and dried chiles and set aside.
Heat the olive oil in a large pan. Cook the onions until translucent, then add the garlic and bell peppers and toss briefly. Add the tomatoes and simmer to reduce the liquid slightly. Add the cinnamon, the spices from the grinder, and the vinegar, brown sugar and salt. Simmer for about 25 minutes to desired thickness then add the roasted chiles and the tequila or mezcal, if using, and cook for an additional 10 minutes.
Taste to achieve the perfect balance of sweet, spicy, tangy and piquant—adding more vinegar, brown sugar and salt, if needed. Keep refrigerated for several days.