The phenomenon of splitting of white light into its component colours when it passes through a Prism is called dispersion. The component colours are the VIBGYOR ( V-violent, I-indigo, B-blue, G-green, Y-yellow, O-orange, R-red) these colours are known as spectrum. When from a glass prism a beam of white light is passed 7 colours are obtained. When these seven colour are obtained from the beam of light it is know as spectrum of light. This phenomenon include the refraction of light when passes through the prism which is a transparent refractive medium.
As we know rainbow consist of these seven colours. But in the formation of rainbow, the prism is replaced by tiny droplets, the white beam of light is replaced by the sunlight in this process. Then Dispersion of Sunlight happen through the tiny water droplets which act as a transparent refractive medium present in the atmosphere. This whole process results in the formation of rainbow.