Both are correct.
'Grade 2' is a compound adjective; therefore, it must be grouped in some way to show it is a single adjective.
It is usual to group with hyphens; e.g.
2-seater aircraft, free-range eggs
But, it is also possible to group with title case; e.g.
Billy Elliot tickets; The Queen Mary dock
It is also possible, but unusual, to use more than one method; e.g.
Therefore, Grade-2 would be unusual as it is uses both title case and a hyphen. I do not judge it to be wrong though.
'grade-2 students' (note no capital G) is perfectly correct.
'grade 2 students' (still no capital G) is an error.
Grade 2 students is better than Grade-2 students
grade-2 students is correct
grade 2 students is wrong