When beer is exposed to ultraviolet light, the light causes the riboflavin (or vitamin B2) in the beer to break  isohumulones (the chemical that makes beer bitter). This chain reaction creates a chemical that is similar in smell to the scent skunks produce as their natural defense, thus spoiling the beer.