Cheap way - try Mother's polish. It is an all-purpose metal cleaner & polisher. You can find it in the automotive section.
Another cheap way - "0000" steel wool with light oil in a circular pattern.
If the scratches are too deep, then your local gunsmith could buff them out with an electric buffer/polisher/grinder.
Sorry to be so long replying. My server was down last night.
I put a couple of small scratches on it the first time I re-installed the slide release lever. Sort of semi-circles. Then a couple of days ago I took it to a gunsmith to have my rear signt centered, and he left some scuffs back where he used a rear sight adjustment tool and also he wasn't very careful with the slide release lever.
The moral: adjust your rear sight yourself next time.
Be careful with the slide release lever. I'm learning.
Thanks for the suggestions.
If your frame is matte finished (bead blasted), you may have to have it touched up with a blast.
I haven't tried it, but someone posted that on a matte finish, you can take sand paper and lay it face down on the metal, then tap very lightly with a small hammer. Obviously, you'd have to experiment with different grits and pressure but that might be an alternative to try.
If your slide and frame are more of a "brushed" look, I've touched them up with fine sandpaper that matches the grain - again you have to experiment with various grades and pressure. The key to matching well is to move the paper exactly the same direction as the existing grain.