The red S medal is a "small badge", the blue L medal is a "large badge"
Large badge
If you are able to pass the determined weight for the pig, you'll be able to receive one.
If you breed a heavy pig together, there will be a good possibility that a heavy piglet will be born
Small badge
If you go under the determined weight for the pig, you'll receive one.