Grades are either extremely valuable or worthless. Basically, unless you're failing or you have perfect grades, they're essentially useless.
Some things might have certain requirements, but getting more than the minimum requirement is usually a waste of effort. Of course, you need to be certain you can't accidentally fail.
The effort required for perfect grades gets extremely absurd the further along you are with your education. You'll have to decide for yourself if it's a worthy goal.