Caramel is the result of heating sugar in presence of oxygen. This process produces several compounds which are agents of colour (brown) and basically Maillard products. These compounds as every benzopyrens and other Maillard products are carcinogenic and easily produced in your kitchen by high temperature cooking.
4-Methylimidazole may be formed in the browning of certain foods through the Maillard reaction between carbohydrates and amino-containing compounds. In particular, it is found in roasted foods, grilled meats, coffee and in types of caramel coloring produced with ammonia-based processes. It may arise also by fermentation.