Shorter wave bends more than large wavelength because speed of light for short wavelength is less than speed of large wavelength in glass.and due to that refractive index for short wavelength in that particular medium is more than that of large wavelength.And according to snell's law
sin i/sin r =n2/n1=v1/v2
It can be seen that angle of refraction depends on velocity of light and hence angle of refraction if diffraction is different for different for different wavelength. And you see a colored spectrum by using prism where each color corresponds to different wavelength of light.