Ramification divisor associated to a cover of a regular scheme Let $S$ be the spectrum of $\mathbf{Z}$ or the spectrum of an algebraically closed field. (Actually, one can take $S$ to be any noetherian integral regular scheme.)
Let $f:X\longrightarrow Y$  be a finite  morphism of integral normal projective flat $S$-schemes which is etale above the complement of $B$, where $B\subset Y$ is a closed subscheme of codimension $1$. Suppose that $Y$ is regular.  
Example. You could take $f$ to be a finite surjective morphism of normal surfaces such that $Y$ is nonsingular.
Since $Y$ is regular, we have a canonical sheaf $\omega_{Y/S}$. Let $s$ be a nonzero rational section of $\omega_{Y/S}$.
Define the cycle $K_{X/S} := \mathrm{div}(s)$. Note that $K_{X/S}$ is a canonical divisor.
Let $f^\ast s$ be the induced nonzero rational section of the line bundle $f^\ast \omega_{Y/S}$ on $X$ and consider the Weil divisor $\mathrm{div}(f^\ast s)$ on $Y$.
Outside $f^{-1}(B)$, we have that $\mathrm{div}(f^\ast s)$ is the pull-back of $K_{Y/S}$. Therefore, there is a Weil divisor $R_f$, supported on $f^{-1}(B)$, such that $\mathrm{div}(f^\ast s) = f^\ast K_{Y/S} + R_f$. 
Question 1. How are the coefficients of  $R_f$ defined?
Question 2. Is the Weil divisor $\mathrm{div}(f^\ast s)$ a canonical divisor outside the singular locus of $X$?
Question 3. Is $R_f$ independent of $s$?
Note that I work with cycles and not with classes up to linear equivalence.
 A: For the sake of simplicity, let $S=\operatorname{Spec}(k)$. I also suppose that there is no wild ramification, for instance requiring that $\textrm{char}(k) > \deg(f)$.
Answer to Question 1. It depends on the local behaviour of the cover around $R_f$. For instance, if $X$ is also smooth and $f$ is a Galois cover with group $G$, the multiplicity of each component $R_i$ of $R_f$ is $|\textrm{Stab}(R_i)|-1$, where  $\textrm{Stab}(R_i)$ is the stabilizer subgroup of $R_i$.
Therefore, if $f$ is a double cover each component of $R_f$ appears with multiplicity $1$, if $f$ is a cyclic triple cover each component appears with multiplicity $2$ and so on.  
Answer to Question 2. Yes, essentially by definition of canonical divisor. In particular, when $X$ is also smooth we have the identity $$K_X = f^*K_Y +R_f,$$
which is known as Hurwitz formula.
Answer to Question 3. Yes, $R_f$ is independent of $s$. In fact, its support coincides with the locus of points $x \in X$ where the differential $$df_x \colon T_xX \longrightarrow T_{f(x)}Y$$ is not an isomorphism, and this  clearly does not depend on $s$.  
A: Your hypothesis imply that $\omega_{Y/S}$ is an invertible sheaf (because $Y\to S$ is locally complete intersection).
(EDIT) As $f$ is flat at points of codimension $1$ ($Y$ is normal) and we are only interested on codimension 1 cycles, we can restrict $Y$ and suppose that $f$ is flat.
Then the dualizing sheaf $\omega_{X/Y}$ is invertible and you have the adjunction formula
$$\omega_{X/S}=f^*\omega_{Y/S} \otimes\omega_{X/Y}.$$
The sheaf $\omega_{X/Y}$ is trivial outside of $B$ because $f$ is étale outside of $B$. It can be identified with the sheaf $\mathcal{Hom}_{O_Y}(f_{*}O_{X}, O_{Y})$.
Write $\omega_{X/Y}=O_X(D)$ for some Cartier divisor $D$ on $X$. Its support is contained in $f^{-1}(B)$. For any point $\eta$ of $X$ over a generic point $\xi$ of $B$, the stalk of $\omega_{X/Y}$ at $\eta$ is given by the different ideal of the extension of discrete valuation rings $O_{X,\eta}/O_{Y, \xi}$. The valuation of the different is known to be the ramification index $e_{\eta/\xi}$ minus $1$ when the ramification is tame and bigger or equal to $e_{\eta/\xi}$ otherwise (see Serre: Local fields). So the support of $D$ is equal to $f^{-1}(B)$ and is the ramification locus by definition.
In short, the coefficient of $R_f=D$ at the Zariski closure of $\eta$ is the valuation of the different ideal of $O_{X,\eta}/O_{Y, \xi}$. As for the computation, you can pass to the completions.
A finite extension of complete DVR $R'/R$ is monogenous if the residue extension ($k(\eta)/k(\xi)$ in your case) is separable. If $R'=R[\theta]$, and $P(T)\in R[T]$ is the minimal polynomial of $\theta$, then the different ideal is generated by $P'(\theta)$. See Serre's book for more details.
