Yes, you can replace hay with grass. It is essentially the same thing except grass has more vitamin C as it's not sun-cured. Everyone uses hay as it is more convenient storage-wise; grass is perfectly fine.
However, all grasses are not nutritious so you would have to give them the same species (timothy, meadow, bluegrass, bermuda, etc. - the usual stuff) but in grass form so that you know that the nutritional content is alright.
I have fully replaced my hay with grass as we don't get good hay here and the one we did, gave my piggy a URI. You have to do it gently, though - start by giving them a handful of grass and increase the amount slowly or the increased water intake can cause diarrhoea. However, the pigs absolutely love to eat it!