No, granules cannot be tagged, but batches of it can be, so once it gets to the lab, the head technician knows exactly which batch of each product they are using in which pills. Tags can be read with handheld devices or as they travel through static readers in a warehouse or holding room.
As each batch of a specific pharmaceutical is finished, that too gets a special tag, specifying when it was made, by whom it was made, what temperature it needs to be stored at, where it is headed and many other particulars which can all be brought up on that laptop whenever needed.