I'm not sure if this is what you are looking for but...
I have a simple script I created to dynamically populate the meta keywords with random keywords taken from an array.
Put this in the header of your template file.
<meta name="keywords" content="<?php get_keywords()?>" />
This will create a comma delimited list of no more than 10 keywords from an array of keywords. If you wanted to avoid a database query each time you could hard-code arrays of possible keywords for each category. If you don't mind a query, you could replace the array with a query which returns an array.
function get_keywords(){
$keywords=array('keyword1','keyword2','keyword3','keyword4','keyword5');
if (count($keywords)<10)
$max=count($keywords);
else
$max=10;
$rand_keys = array_rand($keywords, $max);
foreach($rand_keys as $vals){
$keyword[]=$keywords[$vals];
}
echo implode(", ", $keyword);
}
Hope this helps.