Natural compounds in some foods, particularly acids, corrode metal and make a dark deposit on the underside of jar lids. This deposit on lids of sealed, properly processed canned foods is harmless. This is commonly referred to as pinholes.
Sometimes they are caused by how the lids are handled. Lifting lids out of water with a metal tool may scratch the enamel on the lid providing a pathway for acids to work their way through the lid. More often, it is simply a chemical reaction with the metal and the food in the jars. As a reminder, today’s canning lids do not require pre-heating prior to applying them to the jar. Simply wash and dry them and they are ready to use.
Pinholes are harmless unless holes go all the way through the lid. Salt can also cause corrosion on lids. Using proper headspace can reduce contact of the food with the lid. If food is stored too long, acids may create pinholes. Discard the contents of any jar if the pitting has gone completely through the lid — the jar would be unsealed and the contents could be unsafe.
Sources: https://nchfp.uga.edu/questions/FAQ_canning.html#13 and https://extension.psu.edu/frequently-asked-preservation-question-pinholes-in-lids