Let $L_{n} = \{x \in \Sigma^* | x = ywz, w^R = w, |w| \geq n, |y| = |z| \}$
Generate a cfg of $L_n$
For n = 1, 2, 3
Informally, x is in $L_n$ means some palindrome of at least length n is a substring of x that occurs exactly at the midpoint of x.
for $n = 1$
$S \to 0S0 | 1S1 | 0S1 | 1S0|0 | 1 | 00 | 11$
for $n = 2$
$S \to 0S0 | 1S1 | 0S1 | 1S0 | 0A0 | 1A1$
$A \to 0 | 1 | \epsilon$
for $n = 3$
$S \to 0S0 | 1S1 | 0S1 | 1S0 | 0A0 | 1A1$
$A \to 0 | 1 | 00 | 11 | \epsilon$
would this be right?
Say I changed it to $|y| > |z|$ or $|y| < |z|$ how would this differ?
Everything here is assuming $\Sigma=\{0,1\}$.
Your solution for $n=1$ and $n=2$ are correct, but $n=3$ is not quite right because it allows $11$ and $00$ which are not in $L_3$. To fix this, simply remove $\epsilon$ from the rule for $A$. The following solution, while verbose, scales well for any $n$.
The rule $A_i$ will be the rule that produces every palindrome of length $i$ or $i-1$. For $i\ge3$, $$ A_i\longrightarrow 0A_{i-2}0\text{ }|\text{ }1A_{i-2}1\text{ }|\text{ }0A_{i-3}0\text{ }|\text{ }1A_{i-3}1 $$ Let $$ A_2\longrightarrow 0\text{ }|\text{ }1\text{ }|\text{ }00\text{ }|\text{ }11 \\ A_1\longrightarrow \epsilon\text{ }|\text{ }0\text{ }|\text{ }1 \\ A_0\longrightarrow \epsilon $$
Then any $L_n$ can be produced by the rules for $A_0, A_1, ..., A_n, A_{n+1}$ and starting symbol $S$ with rule$$ S\longrightarrow 0S0\text{ }|\text{ } 0S1\text{ }|\text{ }1S0\text{ }|\text{ }1S1\text{ }|\text{ }A_{n+1} $$
For $n=1$, we can write, $$ S\longrightarrow 0S0\text{ }|\text{ } 0S1\text{ }|\text{ }1S0\text{ }|\text{ }1S1\text{ }|\text{ }A_2 \\ A_2\longrightarrow 0\text{ }|\text{ }1\text{ }|\text{ }00\text{ }|\text{ }11 \\ A_1\longrightarrow \epsilon\text{ }|\text{ }0\text{ }|\text{ }1 \\ A_0\longrightarrow \epsilon $$
For $n=2$, we can write, $$ S\longrightarrow 0S0\text{ }|\text{ } 0S1\text{ }|\text{ }1S0\text{ }|\text{ }1S1\text{ }|\text{ }A_3 \\ A_3\longrightarrow 0A_{1}0\text{ }|\text{ }1A_{1}1\text{ }|\text{ }0A_{0}0\text{ }|\text{ }1A_{0}1 \\ A_2\longrightarrow 0\text{ }|\text{ }1\text{ }|\text{ }00\text{ }|\text{ }11 \\ A_1\longrightarrow \epsilon\text{ }|\text{ }0\text{ }|\text{ }1 \\ A_0\longrightarrow \epsilon $$
For $n=3$, we can write, $$ S\longrightarrow 0S0\text{ }|\text{ } 0S1\text{ }|\text{ }1S0\text{ }|\text{ }1S1\text{ }|\text{ }A_4 \\ A_4\longrightarrow 0A_{2}0\text{ }|\text{ }1A_{2}1\text{ }|\text{ }0A_{1}0\text{ }|\text{ }1A_{1}1 \\ A_3\longrightarrow 0A_{1}0\text{ }|\text{ }1A_{1}1\text{ }|\text{ }0A_{0}0\text{ }|\text{ }1A_{0}1 \\ A_2\longrightarrow 0\text{ }|\text{ }1\text{ }|\text{ }00\text{ }|\text{ }11 \\ A_1\longrightarrow \epsilon\text{ }|\text{ }0\text{ }|\text{ }1 \\ A_0\longrightarrow \epsilon $$
And so on.
If $|y|>|z|$, then we just add the rule $$ R \longrightarrow 0R\text{ }|\text{ }1R\text{ }|\text{ }0S\text{ }|\text{ }1S $$ and let $R$ be the starting symbol.
If $|y|<|z|$, then we just add the rule $$ R \longrightarrow R0\text{ }|\text{ }R1\text{ }|\text{ }S0\text{ }|\text{ }S1 $$ and let $R$ be the starting symbol.