Just look at your tbopen file it is a variable defining HTML
$tbopen = <<<UBBTPRINT
<table width="{$theme['tablewidth']}" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
<tr>
<td>
<table cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}" width="100%" class="tableborders">
UBBTPRINT;
Basically the start or ubbtprint takes the place of quotes in a normal variable definition and you do not have to escape enclosed quotes.