This will replace the default completion (files) with hosts, for the command sshx (which is a custom script)
compdef _hosts sshx
To complete on only some type of files (ex: *.gp) you can do:
compdef '_files -g "*.gp"' gnuplot
Perhaps you use some new program, say ninja, and zsh has no _ninja completer for it.
If ninja accepts a –help option, you can try using _gnu_generic as a completer for it:
compdef _gnu_generic ninja