I think this is a pretty US-only type thing; at least it's not very common in Europe. Usually (in Europe) ownership of code depends entirely on when you did the coding -- if it's on your own time you own the code. If it's when you're at work then obviously it's the company's code. Of course there are the usual caveats about "is it too closely related to work code?", etc. but if it's a totally different area of business, then you should be fine. There may be differences between employers, but even if employers explicitly specify the "we own everything" clause you can usually get specific exemptions as long as you ask in advance.[1]
[1] I don't know if there's any legal theory (in Europe) to support the claim of ownership over everything you do, but Europe is pretty fragmented when it comes to law, so it's probably pointless to speculate on this point. I'm actually not sure if the "we own everything" clause would hold (or has held) up in court in any European country.