Then what the grades are given for/based on?
There are also summative tests that are meant to measure performance in aggregate, but aren't used for student grades.
The answer is that the types of standardized tests that these country-wide statistics are based on are not, in the US at least, the tests that generate your grades or your university admission.
Then what the grades are given for/based on?