They're a measure of progress. Usually a student will prepare with the music teacher, who'd assess a suitable level to attempt. No point in trying for grade 8 when you're playing at grade 1 for instance. All the details are on the web sites. And it's possible to sit the ABRSM (not sure about Trinity) internationally.
We have different exams in Germany, and they're mostly voluntary, although to get into university for music, you need an exam assessed standard that is, as far as I know, equivalent to grade 8.