Código PHP:
function Algo(){
$output = "";
while($row = mysql_fetch_array($result)){
$output.= "<td class=caract width=33%>$row[CPU]<br /> $row[RAM]< td>";
if($row[ID] % 3 == 0){
$output.= "</tr><tr>";
}
}
return $output;
}
$mivariable = algo();
Y después cuando necesites imprimir el contenido de $mivariable le haces un
echo $mivariable;