In a terminal, the Tab key and Return keys insert the control sequences Ctrli and Ctrlm, respectively. There is no way for an application running in this environment to distinguish them.
Emacs can and does distinguish the keys from their corresponding control sequences in graphical mode, e.g. X Windows. In this case, you can simply use
global-set-key or similar as normal.
If you want to use these particular sequences for other things in the terminal, you will have to catch and change the inputs before they reach the terminal. You could use
xbindkeys along with
xdotool. That would look something like this:
"xdotool key --clearmodifiers F8"
"xdotool key --clearmodifiers F9"