A cosine between the cam-view-direction and the ray computes something like a specular area. A highlight. You can compare that with a kind of Phong shading. The more the ray is pointing "away" from the camera center, the lower this cosine gets. In the context of path tracing this would more be like a reflection of the surrounding objects being stronger visible in that area.
(pdf = path distribution factor, if I am not mistaken) In the second snippet as I understand it, might be a bug? Because you probably want to store the average radiance and not something scaled=multiplied by pdf. But the pdf was computed as 1/... in the first snippet, so the division would turn out to be a multiplication. Seems odd.
/* Second thought: Normally you would have a factor "alpha" with the cosine, which controls the size of that highlight area. With just the cosine, that factor would be always 1.... maybe the radiance (second snippet) is meant to be that factor, but it does not quite make sense, because radiance is a vector. */