If I have a command in the form
\newcommand{\TM}[1]{\color{red} $\boldsymbol{#1}$}
how can I call it with an optional parameter for color? What I want is that if it's called like
\TM{\alpha}
it should return a red alpha but if it's called as
\TM[green]{\alpha}
the alpha's color should be green.

\newcommand{\TM}[2][red]{{\color{#1}$#2$}}(or, better,\newcommand*{\TM}[2][red]{{\color{#1}$#2$}}). Note the additional pair of braces (this is unrelated to your question, though)! – GuM Mar 11 '17 at 02:26