Au lieu de `alsoletter={*,-,$}`, vous avez besoin de `alsoletter={*-$}` :
\documentclass{article}
\usepackage{listings}
\usepackage{fancyvrb}
\usepackage{xcolor}
\colorlet{keyword20}{cyan}
\colorlet{keycolor}{green!50!black}
\colorlet{dollarcolor}{violet}
\lstset{frame=single,%
language=[LaTeX]{TeX},%
showspaces=false,%
breaklines=true,%
breakatwhitespace=true,%
basicstyle=\ttfamily\bfseries,%
alsoletter={*-$},%
texcsstyle=*[2]\color{red},%
texcs=[2]{matrice,declarermatrice*},%
texcsstyle=*[3]\color{blue},%
texcs=[3]{declarermatrice},%
keywordstyle=[20]\color{keyword20},%
keywordstyle=[40]\color{keycolor},%
keywordstyle=[50]\color{dollarcolor},%
keywords=[20]{array,NiceArray},%
keywords=[30]{x,S,T,I,J,C,O,D},%
keywords=[40]{out-of-box,prefix,envir,typeord,argopt},%
keywords=[50]{$}%
}
\begin{document}
\begin{VerbatimOut}[gobble=0]{code00.tex}
$\matrice<prefix=b, envir=NiceArray, argopt={{l c r}}>{1, 2, 3, 4, 5, 6, 7, 8, 9}$
\begin{NiceArray}{r l} a & b \end{NiceArray}
\end{VerbatimOut}
\lstinputlisting[gobble=0]{code00.tex}
\end{document}\end{document}
![alt text][1]
[1]: https://texnique.fr/osqa/upfiles/Screenshot_2022-07-02_at_19.54.48.png