How can I set certain parts of an lstlisting in boldface?
\begin{lstlisting}[escapechar=@]
fun(foo, bar, @\textbf{baz}@ );
\end{lstlisting}
This compiles, but baz isn't set in boldface :( What am I missing?
Your basic approach should be to tell listing what words to emphasise. A straightforward way to do this is like this:
\lstset{emph={baz},emphstyle=\textbf}
Of course, that will emphasise baz
whenever it occurs. But this is a better approach than trying to put the markup into your listing itself, you don't (ought to) want to do that since you (ought to) want to use listings to format an unmodified piece of code. Especially so if you are including source files rather than typing code snippets.
Once you've got the basics under your belt look at the documentation, to learn how to set styles for keywords and for identifiers, and how to modify the inbuilt list(s) of keywords for your languages of choice.