This is by far the most powerful, but also most complicated, feature of the Advanced Rename dialog. Using VBScript, JScript or other ActiveX scripting languages, you can write a rename function that gives you complete control over the outcome of the rename operation.
See the Rename Scripts page in the Scripting section for more information about writing rename scripts.