the best way to touch up a scratch in anodizing is two steps:
1) colour with a marker or paint to match. rub the paint or dye in and wipe off with a clean rag. use whichever solvent is appropriate to get it off of any overage areas.
2) this is the hard part. since anodizing is a crystalline coating of hexagonal aluminum oxide, its tough, but non-directional. it has no grain to match. any lines you scratch into it by trying to buff or sand will be visible as different. take 800 grit sandpaper (silicon dioxide - black - waterproof) and place wet over the scratch area. then, using gentle taps, strike the back side of the paper with a small rubber mallet, or a wooden dowel. keep tapping and checking the scratch area until the scratch is "gone". it won't be perfect, but it will be much better. once the scratch is gone, re-apply the dye or stain to the area again and repeat as necessary.
the logic here is that the scratch has cut through the surface oxide crystals. since its made up of essentially little glass tubes filled with colour, you have to smooth the shards out with impact. since the process causes some of the little tubes to crack open differently than they were before, you keep applying pigment to keep getting it into the tubes that open up. hopefully when you are all done, the pigment will have seeped into enough of the broken tubes to make it look invisible.
caveat - this process does work well for some anodizing (it depends on how the anodizing was applied), and not so well for others. its entirely a hit or miss. just go slow. if you want to be extra safe, dry the surface out between attempts with a hair dryer. the wetness from the sandpaper can sometimes make the repair look better than it is.
once done and happy with the repair, put the part in boiling water for a few minutes to seal up the tubes (the heat and moisture cause a change in the crystal structure at the surface). if its not possible to submerge the part, you can just set your kettle to boil and direct the steam discharge at the area. or you can omit this step with the understanding that if you don't seal the tubes, the colour will disappear over time from oxidation and cleaning.