Where should I put new UFactory?

I want to import custom file. I’ve read on answers somewhere that for this I have to derive from UFactory. OK, but where should I put that class? In the game module? Or create new (probably editor) module? Or do this right in the engine sources without creating any modules (or creating)? I’m confused!

What are general rules for such editor modifications?

It should go into a new Editor module that you create as part of your project or plug-in.