<?php

$mystring = "ABEH A501; BIOL L340; BIOL Z620; Q799; ABEH A501";

echo preg_replace('/[a-zA-Z]{4}\s+[a-zA-Z]\d{3}(*SKIP)(*F)|\w+\W*/', '', $mystring);