How does Health Star Rating work?

Why chocolate milk has more health stars than regular milk

Primo proudly displays its 4.5 health star rating, while actual milk settles for just 3.5 stars.