There is no point in sorting in this case. You should not use in select anything other than the field by which you group and aggregate functions. For example, postgresql deny your request to you, and it will be right.
Alternatively, you can use something like:
select max(id), gripname from mess where idUser='1' GROUP BY gripname ORDER BY max(id) DESC
In the query above, the DBMS sorts the values according to the maximum id that fell into the grouping. For example, you have a database with values:
id=1, gripname=a id=4, gripname=b id=5, gripname=a
The answer will be output:
id=5, gripname=a id=4, gripname=b