When light goes from one medium to another, it bends. This phenomenon is called refraction.
When it goes from rarer to denser it bends towards the normal. When it goes from denser to rarer, it bends away from the normal.
Let us consider light coming from denser to rarer medium (air).
i is the angle of incidence and r is the angle of refraction in the rarer medium. As we increase i r also increases.
For a certain angle i, angle of refraction r in the rarer medium becomes 90o.
This particular angle i is called the critical angle c. It depends on the refractive index of the denser medium. The greater the refractive index, the smaller the critical angle c.
For angle i>c, the angle of refraction is greater than90o. This refracted ray will come back into the denser medium. This phenomenon is called total internal reflection. Note that since the ray comes back into the same medium, it is reflecting rather than refracting.
Now let us apply it to the case of sparkling diamonds!
Refractive index of diamond is very high. It is 2.42!! (for glass it is just 1.5).
Si critical angle for diamonds is very small. Moreover, we cut the faces of diamonds in such a way that light inside the diamond is falling on the faces at angles greater than the critical angle. So it keeps on getting totally internally reflected. When it is able to come out from any face a whole lot of light comes out, making the diamond sparkle.