Officially, an M or 18 rating means the game is intended for players around 17 and older. Unofficially, plenty of younger players handle mature titles without any trouble — and plenty of older ones do not.
Maturity is not really about age brackets. A 12-year-old who can shrug off a horror game is fine; a 12-year-old who has nightmares after one is not, regardless of what the box says. The rating describes content, not the person holding the controller.
The rating exists for a reason, though. It is a reliable signal about violence, language and themes, and it is worth reading before you buy rather than after. If a game is clearly built around content a child is not ready for, the number on the cover is the useful part.
So: follow the rating as a guideline, then judge the individual. That is the only system that actually works.