Rainbow is the formation occurring in the sky.The lines in a spectrum represent the wavelength or frequency of an electromagnetic radiation which is emitted out when an electron jumps from a higher orbit to any lower orbit. 

For example, when an electron jumps back from 3rd orbit of hydrogen to 2nd orbit, a line in the spectrum is fomed due to emission of energy in the form of light radiation. This is recorded by a spectrophotometer as a line.