There are several compounds found in red meat after cooking or processing that have carcinogenic potential. These compounds are not inherent to the red meat, but are side-effects of introducing either foreign chemicals during preservation or from treating the meat with fire.
They are Heterocyclic Amines (henceforth HCAs), Polyaromatic Hydrocarbons (henceforth PAHs) and Nitrosamines (henceforth NAs).
To look at their relationship with cancer, please read this FAQ page.
Polyaromatic Hydrocarbons are formed during incomplete combustion of fatty acids from meats, which occurs during periods of low oxygen exposure. Although they can be produced to an extent during most cooking processes such as frying or grilling, they are produced most when inadequate oxygen is supplied to the meat or temperatures exceed 250C. They are of most concern when grilling burgers to a crisp in a non-ventilated hood.
There is no inherent way to prevent PAH formation in meats aside from allowing sufficient oxygen to reach the meat and to keep cooking temperatures low.
Nitrosamines are formed when dietary nitrates are paired with amino acids, and the most common meat sources of nitrates are found in 'pink meats' such as ham, pork, and bacon due to being great preservatives.
Combining nitrates with reducing agents can prevent a good deal of nitrosamine formation, and is a reason why dietary nitrates from vegetables are not associated with increased cancer risk as are the nitrates added to meat products (as vegetables have plenty of reducing agents). 'Reducing agents' is sometimes synonymous with 'anti-oxidants', and Vitamin C is the standard research molecule to prevent nitrosamine formation.
'Nitrates' and 'Nitrites' are almost identical, just nitrites are the oxidized form and nitrates the reduced form. Nitrates cannot form nitrosamines, but nitrites can; thus keeping as much of this molecule in the reduced form via reducing agents confers a protective effect after ingestion.
Nitrosamines are not inherently carcinogenic, but are through their degradation product called methyl carbonium which nitrosamines can degrade into but nitrates cannot.