I want to model a three phase grid connected inverter with LC filter. My question is whether the ground of inverter, C filter, and the grid need to be the same ground or I should consider different grounding for them? I am not sure which one I need to consider N and which ones G.
The spot where you access the incoming grid wire or wires is the spot where you should access the neutral wire. It can be at your chief load, or distribution point, or at your meter. The earth connection is not necessarily nearby nor or accessible or maintained properly.
Three phase inverter doesn't necessarily connect neutral. X capacitors for filtering PWM carrier can be delta or star connected between phases depending on their voltage rating. Only if the inverter is designed to supply single phase loads, it needs N connection and respective star connected filter capacitors.
The inverter will probably have additional Y capacitors star connected to protective earth.