Refraction is the change in direction of light when moving from one medium to another. This phenomenon is exploited to make lenses, from those used in eyeglasses, microscopes and refracting telescopes.
The degree to which a medium refracts light is expressed as that medium's index of refraction. For most materials, the index of refraction changes gradually with the wavelength (color) of the light. Because of this wavelength dependence, a glass prism will separate the components of white light according to their wavelengths, creating the colors of the rainbow. Rainbows are the result of the wavelength-dependence of water's refractive index.
The amount that the direction changes when moving between the two media is determined by Snell's Law.