Short answer. A grinding hub motor almost always means worn bearings, a broken freewheel clutch, or a stripped planetary gear inside a geared hub. All three can be repaired, and geared hubs are usually cheaper to rebuild than replace.
Step by step
Isolate the noise. Spin the wheel with the bike off the ground. If the grinding happens only under power, it is likely internal gears. If it happens whenever the wheel spins, it is bearings.
Check for play. Grab the wheel at 12 and 6 and rock. Any play means the bearings are loose or gone.
Do not keep riding it. A grinding hub motor can lock up and throw you off. Get it looked at before your next commute.
Rebuild or replace. Bearings and planetary gears are usually rebuildable for $100 to $200. A full new hub motor is $200 to $500 depending on brand.