Some Prestige Classes have rules for signature weapons that increase in power by spending XP (Weapon Master? I know the Psionic Weapon Master, from Mind's Eye, does this). There are also weapon enchantments that do similar things, with their power based on some increasing aspect of the user (HP, skill points, power points, attributes). Use the Psychic enchantment, from the PsiHB, as a guideline for this.
It'd be nice if there was some sort of official ruleset out there for this, but since it requires DM input I'm glad there isn't. I mean, let's say your Paladin finds a holy sword named "Shatterspike" in the Sunless Citadel. It's only a +1 Flaming sword with a minor special ability. For normal weapons, you either end up selling it, or having it enchanted.
If the DM increases its power as you level for free, he should withhold a bit of treasure from the loot tables, to compensate for what you WOULD have upgraded to/sold to pay for enchantments.
But, on the other hand, he might not give you any choice in which enchantments it upgrades to, which should make it somewhat cheaper. Maybe you didn't want it to upgrade to a +1 Keen Flaming Burst Sure-Striking Body Feeder sword, maybe you'd rather just have a +5 Flaming sword.