Each pixel is sampled for its red, green and blue colour value from which the actual colour is derived.
8 bit sampling allows 256 possible values for each colour and so produces a pallette of 256R x 256G x 256G = approx 16 million colours. This is very close to our eye's perceptual limit and is perfectly adequate for final display but not for some post production processes.
10 bit sampling gives 1024 possible colour values per channel and produces a colour pallette of 1024R x 1024G x 1024B = 64 million colour approx. Although this exceeds the eye's perceptual limit, it's useful for maintaining high quality and to allow complex colour grading, keying and image manipulation during post production.
Some codecs will apply bit depth reduction to reduce the amount of data when storage space or bandwidth is limited.