Avec les extensions `nicematrix` et `tikz` :
\documentclass[10pt]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usetheme{Frankfurt}
\usepackage{nicematrix}
\usepackage{tikz}
\usetikzlibrary{fit}
\tikzset{highlight/.style={rectangle,
rounded corners = 0.5 mm,
inner sep=1pt,
fit=#1}}
\begin{document}
\begin{frame}
\begin{center}
$T = \begin{pNiceMatrix}[first-row,last-row]
\CodeBefore [create-cell-nodes]
\tikz{
\node[fill=red!50] [highlight = (1-1) (2-2)] {} ;
\node[fill=green!50] [highlight = (1-3) (2-3)] {} ;
\node[fill=blue!50] [highlight = (3-3) (3-3)] {} ;
}
\Body
\Block{1-2}{A} & & B\\
\omega_1 & \alpha_1 & \gamma \\
0 & \omega_2 & \alpha_2 \\
0 & 0 & \omega_3\\
& & D\\
\end{pNiceMatrix}$
\end{center}
\end{frame}
\end{document}
![alt text][1]
[1]: https://texnique.fr/osqa/upfiles/Screenshot_2023-07-09_at_22.42.24.png