Defintion. Rank of real matrix $\textrm{A}$ (symb. $\textrm{rank}\left(\textbf{A}\right)$) is the number of lineary independent columns (or rows) of $\textrm{A}$.
Example. If
$$
A=\left(\begin{array}{cc}
1\\
1\\
1\\
1
\end{array}\begin{array}{cc}
1\\
2\\
3\\
1
\end{array}\begin{array}{cc}
2\\
1\\
0\\
0
\end{array}
\begin{array}{cc}
0\\
1\\
2\\
0
\end{array}
\begin{array}{cc}
-1\\
1\\
3\\
4
\end{array}
\right).
$$
The columns are $A_1=(1,1,1,1)$, $A_2=(1,2,3,1)$, $A_3=(2,1,0,0)$, $A_4=(0,1,2,0)$, $A_5=(-1,1,3,4)$. With elementary operations (Gauss operations) this can be writen as
$$
\begin{array}{cc}
A_1\\
A_2\\
A_3\\
A_4\\
A_5
\end{array}
\left|\begin{array}{cc}
1\\
1\\
2\\
0\\
-1
\end{array}\begin{array}{cc}
1\\
2\\
1\\
1\\
1
\end{array}\begin{array}{cc}
1\\
3\\
0\\
2\\
3
\end{array}\begin{array}{cc}
1\\
1\\
0\\
0\\
4
\end{array}\right|\equiv\left|\begin{array}{cc}
1\\
0\\
0\\
0\\
0
\end{array}\begin{array}{cc}
1\\
1\\
0\\
0\\
0
\end{array}\begin{array}{cc}
1\\
2\\
0\\
0\\
0
\end{array}\begin{array}{cc}
1\\
0\\
1\\
0\\
0
\end{array}\right|
$$
Hence $\textrm{rank}(\textbf{A})=3$
Theorem.(see rank-nullity theorem) A square $n\times n$ matrix $\textbf{A}$ with real elements is diagonalizable in $\textbf{R}$ if and only if all the roots of the characteristic polynomial $X_{\textbf{A}}(t)=\textrm{det}(\textbf{A}-t\cdot \textbf{I}_n)$ are real numbers $t_1,t_2,\ldots,t_{r}$ (eigenvalues) and the multiplicity $m_1,m_2,\ldots,m_r$ of each eigenvalue equals the dimension of the of the eigenspace (the space $E(\lambda_j)$ of proof below) i.e. iff $\textrm{rank}(A-t_j\textbf{I}_n)=n-m_j$, $j=1,2,\ldots,r$.
Proof. Let $\lambda_j$ be eigenvalue of $A$ with algebraic multiplicity $m_j$. We define the space
$$
E(\lambda_j)=\left\{X\in\textbf{R}^n:\textbf{A}X^T=\lambda_j X^T\right\}.
$$
It is known that if $V$ is any $\textbf{R}-$vector space and $f$ a linear map of $V$, then $f$ is diagonalizable if and only if all roots of the characteristic polynomial of $f$ are in $\textbf{R}$ and the multiplicity $m_j$ of every eigenvalue $\lambda_j$ is equal to the dimension of $E(\lambda_j)$. Obviously we can attach to $f$ its matrix $\textbf{A}$ and the oposite. Hence $\textbf{A}$ is diagonalizable iff $\textrm{dim}(E(\lambda_j))=m_j$, $\forall j$. But from rank-nullity theorem for the matrix $\textbf{M}_j=\textbf{A}-\lambda_j\textbf{I}_n$, we have $\textrm{rank}(\textbf{M}_j)+\textrm{Nullity}(\textbf{M}_j)=n$. Hence we get equivalently the condition
$$
\textrm{dim}(E(\lambda_j))=\textrm{Nullity}(\textbf{M}_j)=n-\textrm{rank}(\textbf{A}-\lambda_j\textbf{I}_n)=m_j
$$
and the proof follows.
Example. In your question you have $X_{\textbf{B}}(t)=-(t-2)(t+1)^2$. Hence $t_1=2$ with multiplicity $m_1=1$ and $t_2=-1$ with multiplicity $m_2=2$. But as someone can see $\textrm{rank}(\textbf{A}-2\textbf{I}_n)=2$ and if $b\neq 2$, then $\textrm{rank}(\textbf{A}-(-1)\textbf{I}_n)=2\neq 3-2$. Hence $\textbf{B}$ is not diagonazible for any $b\neq 2$. However for $b=2$, we have
$$
\textrm{rank}(\textbf{A}+\textbf{I}_n)=\textbf{rank}
\left(\begin{array}{cc}
6\\
3\\
-6
\end{array}\begin{array}{cc}
-6\\
-3\\
6
\end{array}\begin{array}{cc}
0\\
0\\
0
\end{array}\right)=1
$$