Take a few hours to read, over and over and over again, the
Quake III Arena Shader Bible. After you read it, read it again. Then, just for good measure, read it three more times. Completely. Don't skim. Then, after you feel like you fully, completely, totally understand the basics, the part you will be interested in is the part about skyparms and q3map_surfacelight. Once you've got that down, you should head over to
shaderlab and read the q3map2 manual to understand q3map_skylight--it's a little more useful than just the normal surfacelight.