Melanin, the same compound that determines skin and hair color, is also responsible for different eye colors.
Melanin helps to protect the eye by absorbing light (including some UV light) that hits the iris, which is the part of the eye that controls the amount of light that reaches the retina.