You might be interested in reading Apple's documentation on Speakable Items, but the relevant part to your question, "How can I get OS X to listen for the string "s" and run the program "cmd" in response?" is:
You can add an item to the Speakable
Items folder to make it speakable.
To open something using a spoken
command, just add it to the Speakable
Items folder. You can use a command to
open anything you can open by
double-clicking, including
applications, files, and Web sites.
You can also write scripts and add
them to the folder.
In regards to "How does OS X know what command to run? I see nothing in that file that says what command to run?", the relevant portion of the file you posted is:
<key>BuiltInCommandID</key>
<integer>105</integer>
<key>DefaultCommandName</key>
<string>Tell me a joke</string>
This is saying, when the spoken command "Tell me a joke" is received, run the internal command ID#105, which is the "Tell me a joke" command.
In this case you're looking at an internal command to the speech system. But you can add AppleScripts or shell commands to the speakable items folder as well.
This article on Mac OS X Hints may be helpful as well.
EDIT: After some research I am not sure if you can run shell scripts directly from there, but a little AppleScript wrapper would be easy enough to write, and you could even write it so it can be duplicated and renamed, and it would just run the corresponding shell script from /scripts
or something.
Whichever dictionaries you enable in the Dictionary app's preferences will be available in the dictionary popover. You could either change these whenever you want to switch, or perhaps just leave both languages enabled all the time.
Best Answer
I am not aware of any keyboard shortcut to do so but as a pis aller you can create a Sikuli script that switches from English to French, and another one that switches from French to English, then bind those two scripts to a voice command.