On a television show I was watching, they mentioned that C-4 explosive is tagged in a way that aids the tracing of its origin if it is used in an illicit way like in a terrorist attack.
Possible method of tagging
I have no idea if that is true, but an idea did occur to me about how it could be done if an organization wanted to. What you need is a collection of chemicals that are stable – that can survive an explosion – and which are rare and can be detected individually. Say you have a set of six such chemicals: A, B, C, D, E, and F.
Each is essentially one bit of data: a zero if absent in the explosive in question and a one if it is present. With six bits of data, you could then label 64 different batches with a unique combination of those chemicals. They would range from 000000 to 111111.
As the number of chemicals used increases, the number of distinct batches you can tag increases rapidly, according to the formula 2x, where x is the number of different chemicals used.
After undetonated explosives or an explosion is found, tests could be administered to detect the presence or absence of the marker chemicals. Based on the combination of chemicals present, the marker could be read.
Uses of tagging
If you had a couple of dozen distinct chemicals, you could label a huge number of distinct batches. You could have factories making the stuff identify whether it was sold for civilian use or military use, where it was to be initially sold, etc. You would then have a forensic ability to trace back the explosive to the point of manufacture and maybe identify who was the final user.
This could be especially useful if you suspect a legitimate customer is illicitly trafficking in explosives. Say you suspect a mining company of providing explosives to paramilitary groups, or you suspect an allied country of providing explosives to armed rebels in another country. You could make sure to provide the suspect entity with a specially tagged batch, and then you could take samples at sites of suspected use and look for the markers.
Of course, you could also get caught in the act yourself if you got careless. Someone could work out your marker system for themselves or buy information about it from someone who knows. Then, they might be able to find cases where you were redistributing explosives yourselves through illicit channels.
Also, there will always be some homemade explosives like triacetone triperoxide (TATP) that groups will have access to, but denying them the ability to make covert use of explosives manufactured for legal military purposes or commercial use could nonetheless be valuable.