If this is just a casual riddle, then I can agree with the accepted answer. However, if we want to be mathematically strict, I claim that $3$ and $4$ are not solutions of the equation because they lie outside the domain.

**Disclaimer:** in this post I only consider real exponentiation. It is not my intention to dive into the complex numbers.

What we mean by solving an equation like $f(x) = g(x)$ is finding all $x$ such that both sides make sense and evaluate equal. Hence the first step is always determining the intersection of the domains of $f$ and $g$ - that is, the set of all $x$ such that both sides make sense. Let's consider what that would be in your case.

The left side of your equation naturally decomposes as follows:

$$(x^2-7x+11)^{x^2-7x+6} = p(q_1(x), q_2(x))$$

where

$$\begin{align*}
q_1(x) & = x^2-7x+11 \\
q_2(x) & = x^2-7x+6 \\
p(a, b) & = a^b
\end{align*}$$

So we have to determine the set of all $(a, b)$ such that $a^b$ makes sense (that is, the domain of exponentiation) and then find the set of all $x$ such that the pair $(q_1(x), q_2(x))$ belongs to this set.

And here is the problem.

There is no uniform way to define both $(-1)^5$ and $3^{\sqrt{2}}$. These are different kinds of exponentiation - the first one is obtained as repeated multiplication, the second one is the result of some limit process, and neither definition works for the other side. So we have a choice: if we allow zero and negative numbers as bases, the exponent must be a non-negative integer, so the domain is $\mathbb{R} \times \mathbb{N}$. If we exclude $0$ as a base, we can use negative exponents, which makes the domain $(\mathbb{R} \setminus \{ 0 \}) \times \mathbb{Z}$. If we go further and exclude negative numbers as bases, we can use limits to pass to real exponents, so the domain becomes $(0, \infty) \times \mathbb{R}$.

One could argue that since the three kinds of exponentiation pairwise agree on the intersections of their domains, we could glue them, i.e. consider the exponentiation on $\mathbb{R} \times \mathbb{N} \cup (\mathbb{R} \setminus \{0\}) \times \mathbb{Z} \cup (0, \infty) \times \mathbb{R}$. But that would be unnatural, useless and - in my opinion - ugly.

Now: which exponentiation does the original equation involve? If the one with natural or integral exponents, then we would have to restrict the domain to those $x$ for which $x^2-7x+6$ is an integer. That doesn't seem right.

Hence we are left with the third, which means we should not consider those $x$ for which $x^2-7x+11$ is negative. This rules out $3$ and $4$ as potential solutions*.

Of course, if we just substitute $x=2$, we get

$$1^{-4} = 1$$

which we know is true and if we substitute $x=3$, we get

$$(-1)^{-6} = 1$$

which we know is equally true, leading to an illusion that both solutions are on equal terms. But that illusion results from using the same notation $a^b$ for two different kinds of exponentiation and it does not stand passing to a strict setting.

*Note: I chose the type of exponentiation that seemed to me to fit in better with the equation. In fact, that choice is an inseparable part of the problem, so it should be disambiguated by the author of the equation (and stated alongside it).