Depends on how you send it.
Imagine you send it in ASCII, meaning you'll receive a string.
#define DESCRIPTOR 'P'
char temp[4];
temp[3] = '\0';
if (Serial.available() > 5) { //<descriptor><value><value><value><end character>
if (Serial.read() == DESCRIPTOR) { //first is correct.
for(int i = 0; i<3; i++) {
temp[i] = Serial.read();
}
if (Serial.read() == '\n') { // the string is correct... sort of ...
pwm = atoi(temp);
}
analogWrite(pwm); //there you go...
However, you can avoid that if you control the software that sends the command. What are you using to send the command?