There are several reasons corrosion could be forming in your distributor cap. One of the most common reasons, is that your distributor cap has a hairline crack that is admitting water and condensation. Another reason could be that your alternator is overcharging your battery system, and generating a buildup of corrosion producing battery acid. Other than that, it is possible that the wires could be porous and are attracting water into the distributor, which in turn in leading to the corrosion. At times, the distributor cap needs a new gasket, and if the old one is not replaced, it leads to corrosion.