It seems to me that we should that the "pentium4" architecture name for packages is the one we should be using for current hardware. Even that for me "pentium4" sounds old and it is a trademarked word, it seems that the newer stuff is being called that way. Am I right?
It's complicated. Pentium 4 supports various simd instructions, MMX, SSE and SSE2 as well as some other instructions that can speed thing up. OTOH, the Pentium 4 liked a completely different instruction ordering then i686 and its descendants such as the Core platform, as well AMD stayed closer to i686.
So for programs that don't need SSE2 etc, i686 will arrange the instructions for minimal pipeline stalls on everything but Pentium 4. If you need SSE2, well our only choice is Pentium 4.
This is why I was building Pentium M versions of the Mozilla apps as it is a much better minimum version for most CPU's then Pentium 4.
I don't know if there is a clear document that specifies when you should use i386, i686 or pentium4.
Is it compiled on a different way the i686 and the pentium4?
Yes, GCC takes the -march= CFLAG (and CXXFLAG) to target an architectures instruction set and by default the tuning. There is also the -mtune= flag to tune for different architectures. The last browsers I made were with -march=pentium4 -mtune=generic with the -mtune=generic being targeted at the most common CPU's around when that version of GCC was released.
There are also other flags, -msse2 and such to enable sse2, -mfpmath=sse to use SSE for floating point math saving the overhead of switching over to the ix87 math co-processor for floating point math.
Many a thing from Firefox to Windows and most Linux dists now need SSE2 and have a minimum requirement of Pentium M or such. Pentium M is a bit weird because while it supports PAE memory extensions, it advertises it doesn't, installing Ubuntu on my Thinkpad 42 needs a kernel parameter to force PAE for example. Windows probably just does the forcing.