Well, I'm not the most versed person with this kind of template, but if you add into the code things such as:
<!-- #BeginEditable "keywords" -->
<meta name="keywords" content="<?=$phpVar;?>">
<!-- #EndEditable -->
You can name the files whatever.php and it will attempt to parse the $phpVar variable, displaying its output. Basically, yes, you can put PHP into the templates, its just a matter of deciding how to do it.