What is the role of triton in buffer for western blot assay? I understand it has to do with preventing non-specific binding of the antibody.
That's exactly it. Triton is a detergent and incorporating it just makes it a little more difficult for everything to bind. Here's how I imagine blocking buffer working:
PBS/TBS: buffering pH
milk/BSA: uniformly interacting with the entirety of the blot. The idea is that these will a) adsorb to the parts of the blot that don't already have much sample in them (since "empty" areas of the blot would otherwise adsorb the detection antibody/ies (this is a source of nonspecific binding).
Triton (or, more commonly, Tween-20): OK, now think about what's on your blot. Your antibody will have weak interactions with just about anything there. A detergent interacts with everything it touches (antibody and adsorbed proteins on the blot) to reduce binding affinity in lots of these interactions (although, some interesting counterexamples can be found here), thereby making the less-favorable binding even less favorable, decreasing the chances of your detection antibody retaining these weaker (off-target) interactions. The preceding article also suggests that the use of nonionic detergents lowers the signal intensity of the Western (and to a different degree across proteins).