Wikipedia gives the more general definition. Channel capacity is defined using Information Theory. If you are unfamiliar with that, it will be hard to explain. The channel capacity is always the same for a fixed communications channel (meaning the statistics are fixed).
The more general definition of the capacity $C$ is
$$ C = \sup_{p_X(x)} \mathbf{I}(\mathbf{X};\mathbf{Y}) $$ where $\mathbf{I}$ denotes the Mutual Information, $\mathbf{X}$ is the input to the channel and $\mathbf{Y}$ is the output of the channel, and the supremum is taken over all possible input distributions $p_X(x)$.
The equation that you have provided is specific to the AWGN channel. The plots are demonstrating the performance ceiling that exists because you have chosen not to use a Gaussian input sequence (for convenience usually). Notice that it follows the capacity curve to a certain limit but is then limited by the constellation size.
Codewords are relevant when trying to reach capacity, but not generally applicable in the statement of what capacity is. In other words, the channel capacity is independent of the codewords chosen.