It is a rail grinder, but only a small one. In southern Ontario they seem to be used for switches, yards, crossings, and bad sections of mainline.
The big mainline grinders typically are in the area 1 or 2 times per year.
I love these trains:
A rather epic sight at night: