There are general ways of doing these sorts of things but this is a little simpler if you look at it the right way. For instance this is the union of the language 1a(any)aa(any) with the possible exceptions 1aa(any).

Then just combine the production rules. e.g. here the role of B is duplicated as the final (any)

rules=

{S -> {1, a, A},

S-> {1, a, a, B},

A-> {1, A},

A -> {a, A},

A -> {b, A},

A -> {a, a, B},

B -> {},

B -> {1, B},

B -> {a, B},

B -> {b, B}};

Then production of the words could be implemented with ReplaceList, e.g.,

first setting up the rules to replace a whole list

rules2 = {x___, #[[1]], y___} -> Flatten[{x, #[[2]], y}] & /@ rules

keeping the prefix with x and suffix with y,

{{x___, S, y___} -> {x, 1, a, a, B, y}, {x___, S,

y___} -> {x, 1, a, A, y}, {x___, A, y___} -> {x, 1, A, y}, {x___,

A, y___} -> {x, a, A, y}, {x___, A, y___} -> {x, b, A, y}, {x___,

A, y___} -> {x, a, a, B, y}, {x___, B, y___} -> {x, y}, {x___, B,

y___} -> {x, 1, B, y}, {x___, B, y___} -> {x, a, B, y}, {x___, B,

y___} -> {x, b, B, y}}

Then ReplaceList will do all possible production rules

NestList[Flatten[ReplaceList[#, rules2] & /@ #, 1] &, {{S}}, 2]

Here are the first two iterations

{{{S}}, {{1, a, a, B}, {1, a, A}}, {{1, a, a}, {1, a, a, 1,

B}, {1, a, a, a, B}, {1, a, a, b, B}, {1, a, 1, A}, {1, a, a,

A}, {1, a, b, A}, {1, a, a, a, B}}}

To get the words in the language select those without S, A, or B.

Union[

Select[Flatten[

NestList[Flatten[ReplaceList[#, rules2] & /@ #, 1] &, {{S}}, 4],

1], Count[#, S | A | B] == 0 &]]

which yields these after 4 iterations.

{{1, a, a}, {1, a, a, 1}, {1, a, a, a}, {1, a, a, b}, {1, a,

1, a, a}, {1, a, a, 1, 1}, {1, a, a, 1, a}, {1, a, a, 1, b}, {1, a,

a, a, 1}, {1, a, a, a, a}, {1, a, a, a, b}, {1, a, a, b, 1}, {1, a,

a, b, a}, {1, a, a, b, b}, {1, a, b, a, a}}