Juerg,
Generally, it is better to avoid looping-- there is almost always a list-based approach that is faster. I was not aware that the text strings would be very large. I assumed that since the options are repeating over and over that you would be breaking up the file somehow before running this code snippet. In the case that you are looking for only one option in a large file, the looping code may be a better way.
However, If you can safely assume that there will never be more than 5 or 10 or 15 close brackets in a single option (which seems safe -- or alternatively limit the number of characters in an option), you could modify my list-based routine by cutting the search off at a maximum of, say in this example, 10 brackets. By doing this you would get a significant speedup over the looping code.
Here is a version that only looks 10-deep and runs about 4 times faster than the looping version (I read in your file as text):
findOption3[text_String, option_String] :=
Module[{possible, opencnt, closecnt, cutoff,
subtext = StringDrop[text, StringPosition[text, option ~~ "{"][[1, 2]]]},
cutoff = Last[ StringPosition[subtext, "}", 10]][[1]];
possible = StringCases[StringTake[subtext, cutoff], StartOfString ~~ x___ ~~ "}" -> x, Overlaps -> All];
opencnt = StringCount[possible, "{"] - StringCount[possible, "\{"];
closecnt = StringCount[possible, "}"] - StringCount[possible, "\}"];
option <> "{" <> possible[[Position[opencnt - closecnt, 0][[-1, 1]]]] <> "}"]
In[30]:= Timing[findOption[text, "\\def\\opa"];]
Out[30]= {0.0056, Null}
In[31]:= Timing[findOption3[text, "\\def\\opa"];]
Out[31]= {0.00156, Null}
Here is a version that allows only 100 characters in an option -- it runs even faster
findOption4[text_String, option_String] :=
Module[{possible, opencnt, closecnt, cutoff,
subtext = StringDrop[text, StringPosition[text, option ~~ "{"][[1, 2]]]},
cutoff = 100;
possible = StringCases[StringTake[subtext, cutoff], StartOfString ~~ x___ ~~ "}" -> x, Overlaps -> All];
opencnt = StringCount[possible, "{"] - StringCount[possible, "\{"];
closecnt = StringCount[possible, "}"] - StringCount[possible, "\}"];
option <> "{" <> possible[[Position[opencnt - closecnt, 0][[-1, 1]]]] <> "}"]
In[38]:= Timing[findOption4[text, "\\def\\opa"];]
Out[38]= {0.001267, Null}