This was a ask the experts discussion in Scientific American in the April 2008 issue. I find it rather interesting because the article basically tells us scientists don't really have a clue on lightning.
Cosmic rays come in as a possibility because they say
Decades of measurements inside thunderstorms have failed to find electric fields large enough to spontaneously spark lightning.
Instead they propose that cosmic ray showers lead to runaway breakdown.
Runaway breakdown occurs when a cosmic-ray particle hits air molecules in the atmosphere, knocking loose high-energy electrons. As these ejected electrons collide with other air molecules, they generate more runaway electrons as well as x-rays and gamma rays, resulting in an avalanche of energetic particles that tears through he cloud
They also point out observed bursts of x-rays and gamma rays in thunderstorms to suppore the proposal. The problem they state with this theory is the way lightning forms a narrow channel that conducts the electricity.
An interesting theory but I can't see how something that appears similar to a nuclear reaction can form into lightning bolts that transfer so much electricity from one level of atmosphere to another. Perhaps they are just not looking high enough to find their electric fields or the electric energy coming from the sun has low voltages in the areas they are measuring but convey enough charge to generate lightning when it reaches the earth, only being visible in the atmosphere (not sure if the principles work for this idea though...).
I thought people might be interested in hearing about this one.
(pardon any typos, I transcribed the quotes...)