On p42 and pp95-96 of the 3e DMG there are rules and guidelines for creating new spells. The rules in a nutshell:
- Access to a library, just as if the character were researching to learn a spell.
- 1,000gp expenditure per week
- 1 week per spell level
- Spellcraft check of 10 + level of spell means the character was successful.
The text notes that creating spells is easy. Assigning a level is hard. The rest of the text is devoted to guidelines for judging level, power, duration, etc.
The guidelines are very good, in my opinion, but require a lot of DM discretion. For the most part, they recommend comparing the new spell with existing spells to determine the level, but there is also advice about certain effects, costs, etc. The section includes a table with recommended damage caps for Arcane and Divine spells by level.