It's the ratio of elevation gain to horizontal travel. You have to visualize the hill as a right triangle.

A 45° angle (no such thing in roads AFAIK!) would be a 100% grade because the two sides of the right triangle are equal, as you travel the hypotenuse.

If you gain 100 feet in 1000 feet of horizontal travel (not surface travel), that's a 10% grade.