Definition: A pair $ (A,B) $ of complex $ (n \times n) $-matrices is said to have Property L if there exist orderings $ (\lambda_{i})_{i = 1}^{n} $ and $ (\mu_{i})_{i = 1}^{n} $ respectively of the eigenvalues of $ A $ and $ B $ such that
$$
\forall (x,y) \in \mathbb{C}^{2}: \quad
\operatorname{Spectrum}(x A + y B) = \{ x \lambda_{i} + y \mu_{i} \}_{i = 1}^{n}.
$$
By Theorems 3 and 4 of T.S. Motzkin, O. Taussky, Pairs of Matrices with Property L. II, Trans. Amer. Math. Soc. 80 (1955) 387-401, if $ \lambda A + \mu B $ is a pencil in which all matrices are diagonalizable, then $ (A,B) $ has Property L, and moreover, $ A $ and $ B $ commute.
EDIT:
Using some concepts in algebraic geometry, Motzkin and Taussky showed that the result above holds for any field $ \mathbb{K} $ (if $ \mathbb{K} $ has finite characteristic, then they further assumed that $ \operatorname{char}(\mathbb{K}) \geq n $). Using complex analysis, Kato (in his book Perturbation Theory for Linear Operators, pp. 82-85) gave another proof that is valid only for $ \mathbb{C} $. Using Kato’s method, Friedland (in A Generalization of the Motzkin-Taussky Theorem, Linear Algebra Appl. 36 (1981) 103-109) and De Seguins Pazzis (in On Commuting Matrices and Exponentials, Proc. Amer. Math. Soc. 141 (3) (2013) 763-774 - An easier access is on arXiv -) showed generalizations of the previous result that are valid only for $ \mathbb{C} $.