Given function f(x, y, z), with gradient \nabla f, we can talk about the "directional derivative" in the direction of unit vector \vec{v} as the dot product: \nabla f\cdot \vec{v}.
In three dimensions, a direction cannot be specified by a single angle. We need two angles such as the "\theta" and "\phi" used in spherical coordinates. Or we can use the "direction cosines", the cosines of the angles the direction makes with the three coordinate axes: \theta_x is the angle a line in the given direction makes with the x-axis, \theta_y the angle it makes with the y-axis, and \theta_z, the angle it makes with the z-axis. Of course, those three angles are not idependent. We can show that we must have cos^2(\theta_x)+ cos^2(\theta_y)+ cos^2(\theta_z)= 1 which means that the vector cos(\theta_x)\vec{i}+ cos(\theta_y)\vec{j}+ cos(\theta_z)\vec{k} is the unit vector in that direction.
That is, the "directional derivative" of f(x, y, z) in the direction that makes angles \theta_x, \theta_y, and \theta_z with the x, y, and z axes, respectively, is given by \nabla f\cdot (cos(\theta_x)\vec{i}+ cos(\theta_y)\vec{j}+ cos(\theta_z)\vec{k})= f_x cos(\theta_x)+ f_y cos(\theta_y)+ f_z cos(\theta_z).