This is just to record some thoughts on the different ideal or equivalently the ramification divisor in the case of quasi-finite morphisms f : X —> Y of locally Noetherian schemes.
The model for the construction is the case where (a) f is finite flat, (b) f is generically etale, and (c) X and Y are Gorenstein. In this case we let ω = Hom(f_*O_X, O_Y) viewed as an O_X-module. By property (c) ω is an invertible O_X-module. By property (a) the trace map Tr_{X/Y} defines a global section τ : O_X —> ω. By property (b) this section is nonzero in all the generic points of X. Since X is Gorenstein we conclude that τ is a regular section. Hence the scheme of zeros of τ is an effective Cartier divisor R ⊂ X. This is the ramification divisor. In this situation it follows from the definitions that the norm of R is the discriminant of f (defined as the determinant of the trace pairing).
Easy generalizations: (1) By suitable localizing and glueing we can replace the assumption that f is finite flat by the assumption that f is quasi-finite and flat. (2) Instead of assuming that X and Y are Gorenstein it suffices to assume that the fibres of f are Gorenstein.
To deal with nonflat cases, the construction works whenever f is quasi-finite, generically etale (i.e., etale at all the generic points of X), the relative dualizing sheaf ω is invertible, and there is a global section τ of ω whose restriction to the etale locus is as above. To make τ unique let’s assume X —Y is etale also at all the embedded points of X.
The trickiest part to verify is the existence of the section τ. If X is S_2, then it suffices to check in codimension 1. Beyond the usual case where X and Y are regular in codimension 1, it works also if the map X —> Y looks like a Harris-Mumford type admissible cover in codimension 1: for example consider the nonflat morphism corresponding to the ring map A = R[x, y]/(xy) —> R[u, v]/(uv) = B sending x, y to u^n, v^n where n is a nonzerodivisor in the Noetherian ring R. Then the ramification divisor is given by the ideal generated by n in the ring B!
In this way we obtain the well known observation that admissible coverings in characteristic zero are not ramified at the nodes.
PS: From the point of view above, the problem with nonbalanced maps, such as the map R[x, y]/(xy) —> R[u, v]/(uv) sending x to u^2 and y to v^3, is that τ is not even defined. So you cannot really even begin to say that it is (un)ramified…
[Edit a bit later] and in fact you can compose with the map R[u, v]/(uv) —> R[a, b]/(ab) sending u to a^3 and v to b^2 to get the map R[x, y]/(xy) —> R[a, b]/(ab) sending x, y to a^6, b^6 whose ramification divisor is empty (provided 6 is invertible in R)…
[Edit on Sept 18] The morphism given by A = R[x, y]/(xy) —> R[u, v]/(uv) = B sending x, y to u^n, v^n is a morphism which is both “not ramified” in the sense above and “not unramified” in the sense of Tag 02G3.