set custom file extension to open with specified program I want to have all files with an extension of .fw.png to open in Fireworks (not necessarily .png files though).

Is there a way to do this in Terminal?
No. OS X file types ignore strings before the final .

You could rename all files x.fw.png to x.fw_png and then map that file type to FireWorks using many existing answers here but totally reprogramming how the OS parses for file extensions would be a hard nut to crack.