I think legal requirements are a US thing. I had only heard of it in HOA run places though.
Here in the UK there are no usually legal requirements, but it might be a social problem as your neighbours will not like it.
Not just HOAs. Talk grass allows insects and vermin to move more freely. In cities, this contributes to their spread, so some places have city-wide ordinances that require lawn maintenance.
Apparently this text is part of the "International Property Management Code", which is incorporated into the municipal code of many cities?
https://codes.iccsafe.org/content/IPMC2024P1/chapter-3-gener...